<?php



/**
 * Exit the script when IN_lico_admin is not defined
 */
if (!defined('IN_lico')) {
	exit;
}


$select = "SELECT m.f_key, m.distversion FROM `machines` m WHERE LOWER(m.distribution)='".lico_ESC(strtolower($distrib))."'";
$retdis = $db->getAll_assoc($select);
for ($a=0; $a<count($retdis); $a++) {
  $f_key = intval($retdis[$a]['f_key']);
  $distribversion = stripslashes(trim($retdis[$a]['distversion']));
  $ndistribversion = "";
  
  if (strtolower($distrib) == "ubuntu") {
    
    if (preg_match("`11[-_\/\.]10`i", $distribversion))
      $ndistribversion = "11.10";
    else if (preg_match("`oneiric`i", $distribversion))
      $ndistribversion = "11.10";
    
    else if (preg_match("`11[-_\/\.]0*4`i", $distribversion))
      $ndistribversion = "11.04";
    else if (preg_match("`natty`i", $distribversion))
      $ndistribversion = "11.04";
    
    else if (preg_match("`10[-_\/\.]10`i", $distribversion))
      $ndistribversion = "10.10";
    else if (preg_match("`meerkat`i", $distribversion))
      $ndistribversion = "10.10";
    
    else if (preg_match("`10[-_\/\.]0*4`i", $distribversion))
      $ndistribversion = "10.04";
    else if (preg_match("`lucid`i", $distribversion))
      $ndistribversion = "10.04";
    
    else if (preg_match("`9[-_\/\.]10`i", $distribversion))
      $ndistribversion = "9.10";
    else if (preg_match("`karmic`i", $distribversion))
      $ndistribversion = "9.10";
    
    else if (preg_match("`9[-_\/\.]0*4`i", $distribversion))
      $ndistribversion = "9.04";
    else if (preg_match("`jaunty`i", $distribversion))
      $ndistribversion = "9.04";
    
    else if (preg_match("`8[-_\/\.]10`i", $distribversion))
      $ndistribversion = "8.10";
    else if (preg_match("`intrepid`i", $distribversion))
      $ndistribversion = "8.10";
    
    else if (preg_match("`8[-_\/\.]0*4`i", $distribversion))
      $ndistribversion = "8.04";
    else if (preg_match("`hardy`i", $distribversion))
      $ndistribversion = "8.04";
    
    else if (preg_match("`7[-_\/\.]10`i", $distribversion))
      $ndistribversion = "7.10";
    else if (preg_match("`gutsy`i", $distribversion))
      $ndistribversion = "7.10";
    
    else if (preg_match("`7[-_\/\.]0*4`i", $distribversion))
      $ndistribversion = "7.04";
    else if (preg_match("`feisty`i", $distribversion))
      $ndistribversion = "7.04";
    
    else if (preg_match("`6[-_\/\.]10`i", $distribversion))
      $ndistribversion = "6.10";
    else if (preg_match("`edgy`i", $distribversion))
      $ndistribversion = "6.10";
    
    else if (preg_match("`6[-_\/\.]10`i", $distribversion))
      $ndistribversion = "6.10";
    else if (preg_match("`eft`i", $distribversion))
      $ndistribversion = "6.10";
    
    else if (preg_match("`6[-_\/\.]0*6`i", $distribversion))
      $ndistribversion = "6.06";
    else if (preg_match("`dapper`i", $distribversion))
      $ndistribversion = "6.06";
    
    else
      $ndistribversion = "XXX";
    
    
    
    
    
    
    
    
  }
  
  
  
  
  
  
  
  if ($ndistribversion != "" && $ndistribversion != $distribversion) {
    if ($ndistribversion == "XXX") $ndistribversion = "";
    $db->unbuffered_query("UPDATE `machines` SET `distversion`='".lico_ESC($ndistribversion)."' WHERE `f_key`='".lico_ESC($f_key)."'");
  }
  
}











?>
